// 处理sessionStorage类

class Sess {

  set(key, value) {
    if (typeof value === 'object') {
      value = JSON.stringify(value)
    }
    sessionStorage.setItem(key, value)
  }

  get(key) {
    // 空处理
    let value = sessionStorage.getItem(key) || ''

    if (value.includes('[') || value.includes('{')) {
      value = JSON.parse(value)
    }

    return value
  }

}

export default new Sess;